package com.example.controller.xitongshouye;

import com.example.service.xitongshouye.XtshouyeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/xitongshouye")
public class XtshouyeController {
    @Autowired
    private XtshouyeService xtshouyeService;


    /**
    * @Author: zdp
    * @Description: 查询所有课程信息
    * @DateTime: 16:24 2022/11/12
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/all")
    @CrossOrigin
    public Map<String,Integer> all(){
        return xtshouyeService.all();
    }

    /**
    * @Author: zdp
    * @Description: 课程总数量
    * @DateTime: 16:24 2022/11/12
    * @Params:
    * @Return :
    */
    @ResponseBody
    @PostMapping("/kcount")
    @CrossOrigin
    public int kcount(){
        return xtshouyeService.kcount();
    }
    /**
    * @Author: zdp
    * @Description；
    * @DateTime: 13:41 2022/11/13
    * @Params: 
    * @Return 
    */
    @ResponseBody
    @PostMapping("/scount")
    @CrossOrigin
   public int scounnt(){
       int scount = xtshouyeService.scount();
       return scount;
   }
    /**
    * @Author: zdp
    * @Description: 待处理事务
    * @DateTime: 16:38 2022/11/23
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/shenhe")
    @CrossOrigin
    public List shenhe(){
        return xtshouyeService.shenhe();
    }

   /**
   * @Author: zdp
   * @Description: 用户总览
   * @DateTime: 16:57 2022/11/14
   * @Params:
   * @Return
   */
   @ResponseBody
   @PostMapping("/userall")
   @CrossOrigin
   public List<Integer> userall(){
       return xtshouyeService.userall();
   }

   /**
   * @Author: zdp
   * @Description: 日期格式
   * @DateTime: 10:52 2022/11/15
   * @Params:
   * @Return
   */
   public void Call(@RequestParam("kaishi") String kaishi,@RequestParam("jieshu") String jieshu){
       System.out.println(kaishi);
       System.out.println(jieshu);
   }

   /**
   * @Author: zdp
   * @Description: 查询某时间段内的课程
    * @DateTime: 8:58 2022/11/21
   * @Params:
   * @Return
   */
   @ResponseBody
   @PostMapping("/call")
   @CrossOrigin
    public List call(@RequestParam("kaishi")String s1, @RequestParam("jieshu")String s2){
       List call = xtshouyeService.call(s1, s2);
       return call;
    }

    /**
    * @Author: zdp
    * @Description: 查询本月课程总数
    * @DateTime: 13:25 2022/11/22
    * @Params:
    * @Return
    */
    @ResponseBody
    @PostMapping("/kechengzong")
    @CrossOrigin
    public List zongshu(){
        List keall = xtshouyeService.keall();
        return keall;
    }
}
